home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 019a / amac40.zip / RFR004.QM < prev    next >
Text File  |  1991-08-02  |  15KB  |  296 lines

  1. *                               RFR004.QM
  2. *                        Written By Tom Hogshead
  3. *                       [ See RFRMxx.QM For Use ]
  4. *                             August 2, 1991
  5. *  Key       Subfile                       Description
  6. * =====  ===============  ====================================================
  7. * @(F6)                   Right Justifies BLOCK (Line Or Character Blocks)
  8. * @(F1)                   Right Justifies DOCUMENT
  9. * @(F2)                   Right Justifies DOCUMENT, Screen Preview
  10. * @(F4)                   Removes Right Justification From LINE Or BLOCK
  11. * @(F5)                   Removes Right Justification From DOCUMENT
  12. * #(f7_)                  Left  Justify Column Block, Right Ragged    (RB)
  13. * #(f8_)                  Right Justify Column Block, Left  Ragged    (RB)
  14. *                                  (RB) = Richard Blackburn Author
  15. *
  16. *         {e:\up\RFRM*}--Return To RFRMxx.QM
  17. *
  18. *-- eoi
  19.  
  20. * 
  21. *┌───────────────────────────────────────────────────────────────────┐
  22. *│ @(F1) Right Justify to file with same prefix, ".rj" extension     │
  23. *└───────────────────────────────────────────────────────────────────┘
  24. * Macros @F1 and @F2 use the right justification program RJ.COM which is
  25. * included and must be located in current directory or path.  See below
  26. * for documentation of RJ.COM.
  27.  
  28. *
  29. @F1 macrobegin
  30.         Unmarkblock Begfile Insertline  * Insert temp line with
  31.         Dropanchor Currentfilename      * CurrentFileName marked
  32.         Find "." Return "B" Return      * Find dot backwards
  33.         Deltoeol ".rj"                  * THEN add ".rj" after dot
  34.         Cut Savefile                    * Cut name.rj to scrap/SaveFILE
  35.         DOS "RJ " Currentfilename       * Right justify file
  36.         ">" Paste Return Return         *
  37.         Editfile Paste Return Quit      *
  38.         Editfile Return                 * Load justified file
  39.  FIRSTWORD:                             * FIRSTWORD loop removes right
  40.                                         * justification from last line
  41.                                         * of paragraph, often neater!
  42.         EndPara Begline                 * Get to end of paragraph
  43.         Shiftright Wordright            * Put cursor on start of first
  44.         Shiftleft Cursorleft            * word on line
  45.         Markcolumn Endline Markcolumn   * Marks from first word to eol
  46. *----Remove Right Justification From Last Line in Paragraph-------*
  47.         Begline
  48.         FindReplace "    " Return " " Return "LN" Return Begline
  49.         FindReplace "   "  Return     Return "LN" Return Begline  *
  50.         FindReplace "  "   Return     Return "LN" Return          *
  51.         Unmarkblock NextPara            * Get to begin next paragraph
  52.         jtrue FIRSTWORD:                * More para? Loop again
  53.  FINISH:                                *ELSE
  54.         Begfile                         * Go tof
  55. *
  56. * 106 bytes Wed  02-20-1991  16:28:30
  57.  
  58. * ......................Documentation for RJ.COM...................
  59. *
  60. *  USAGE: RJ <INFILE> { PRINT_MARGIN F S }
  61. *
  62. *  WHERE: 0=< PRINT_MARGIN =<40              Default = 0   enter like: 8
  63. *   F FILTERS control chars                  Default = OFF enter like: F
  64. *   S SUPPRESS Line Feeds after CR           Default = OFF enter like: S
  65. *
  66. *  PURPOSE:  RJ  Right Justifies  your  printer output,  making  it look
  67. * professional.  RJ  right  justifies  text  files  by  imbedding blanks
  68. * between  words.  It  is compatible  with  VDE or  any other  ASCII text
  69. * editor.  Public domain.
  70. *
  71. *  METHOD: RJ  imbeds spaces  between words.  It calculates  the longest
  72. * line in the  file (40 to  255 char), then  justifies shorter lines (up
  73. * to  15%  shorter ).  Non-printable  control characters  are not counted
  74. * for  formatting  purposes, so  leave  them  in if  you  wish.  Carriage
  75. * Returns,  Line  Feeds,  Form  Feeds,  and  Tabs  are  always processed
  76. * normally  and  printed.  Indenting  at  the  beginning of  the  line is
  77. * disregarded, but any  line with 3+  IMBEDDED spaces, or  any line with
  78. * Tabs is not justified.  This leaves tables, charts, etc.  intact.
  79. *
  80. *   HINTS: All  parameters except  INFILE are  optional and  they may be
  81. * entered in any order; the defaults are above.  Note that the input file
  82. * is left unaltered;  output defaults to  the screen.  This  allows you to
  83. * preview your  printer output.  To print  or copy  your right justified
  84. * file, use the DOS redirection operator: RJ REPORT.TXT  F 6 > PRN.  Save
  85. * your normal parameters in a batch file.
  86.  
  87. * 
  88. *┌──────────────────────────────────────────┐
  89. *│ @(F2) Right Justify, screen preview      │
  90. *└──────────────────────────────────────────┘
  91. * Macros @F1 and @F2 use the right justification program RJ.COM which is
  92. * included and must be located in current directory or path.  See above
  93. * for documentation of RJ.COM.
  94. *
  95. @f2 Macrobegin
  96.     Savefile
  97.     DOS "RJ " Currentfilename Return
  98. *
  99. * 14 bytes Sun  12-02-1990  01:02:50
  100.  
  101. * 
  102. *┌───────────────────────────────────────────────────────────────────┐
  103. *│@(F4) Removes Right Justification from line or block               │
  104. *└───────────────────────────────────────────────────────────────────┘
  105. * Position cursor on first line to be un-justified, press @F4, then
  106. * cursor down to last line to be un-justified, and press <Enter>.
  107. * If cursor is between paragraphs, cursor is automatically placed on the
  108. * first word of the next paragraph.
  109. *
  110. @F4 Macrobegin
  111.         Unmarkblock
  112.  START:
  113.         Endline Begline                 * Test if line not blank
  114.         Jtrue FIRSTWORD:                * If not blank, goto FIRSTWORD
  115.         Wordright                       * If blank, goto first word
  116.         Jump START:                     * and check for blank line again
  117.  FIRSTWORD:                             *
  118.         Shiftright Wordright            * Put cursor on start of first
  119.         Shiftleft Cursorleft            * word on line,
  120.         Gotocolumn "80" Return          * Get all line in block   *
  121.         Markcolumn Prevposition         * Mark column at first word
  122.         Begline                         * Reposition cursor
  123.         Jfalse NEXT:                    * If first word in col.  1,
  124.                                         * test is false, go to NEXT
  125.         Prevposition                    * Otherwise, back to first word
  126.  NEXT:
  127.         Pause                           * Pause to cursor to last line
  128.         Markcolumn                      * Mark end of block
  129.         Gotoblockbeg                    * Get to block begin
  130.         FindReplace "    " Return " " Return "LN" Return
  131.         FindReplace "   "  Return     Return "LN" Return           *
  132.         FindReplace "  "   Return     Return "LN" Return           *
  133.         Unmarkblock                     *
  134.         Nextpara                        *
  135.         Makectrofscreen                 *
  136. *
  137. * 81 bytes Wed  02-20-1991  12:48:50
  138.  
  139. * 
  140. *┌───────────────────────────────────────────────────────────────────┐
  141. *│ @(F5) Removes Right Justification from DOCUMENT                   │
  142. *└───────────────────────────────────────────────────────────────────┘
  143. *
  144. @F5 Macrobegin
  145.         Begfile Unmarkblock             *
  146.  START:                                 *
  147.         Endline Begline                 * Test if line not blank
  148.         Jtrue FIRSTWORD:                * If so, goto FIRSTWORD
  149.         Wordright                       * If not, move to first word
  150.         Jump START:                     * and check for blank line again
  151.  FIRSTWORD:                             * FIRSTWORD loop removes right
  152.                                         * justification from paragraph
  153.         Begline
  154.         Shiftright Wordright            * Put cursor on start of first
  155.         Shiftleft Cursorleft            * word on line,
  156.         Markcolumn Endpara              * and start column mark
  157.         Gotocolumn "80" Return          * Be sure to get all para
  158.                                         * in block
  159.         Markcolumn                      * Mark para as block
  160.         Gotoblockbeg                    * Start @ block begin
  161.         FindReplace "    " Return " " Return "LN" Return         *
  162.         FindReplace "   "  Return     Return "LN" Return         *
  163.         FindReplace "  "   Return     Return "LN" Return         *
  164.         Unmarkblock                                              *
  165.         NextPara                        * Get to begin next para
  166.         Jtrue FIRSTWORD:                * More para? Loop again
  167.    FINISH:                              * No more paragraphs
  168.         Begfile
  169. *
  170. * 80 bytes Wed  02-20-1991  12:46:32
  171.  
  172. * 
  173. *----------------------------
  174. * @(F6) Right Justifies BLOCK
  175. *----------------------------
  176. *
  177. * Mark block to right justify and press @F6.  Block must be a line or
  178. * character block, NOT a column block.
  179. *
  180. *         Remember, block to be right justified must
  181. *         be at  least 2  lines.  Right justification
  182. *         RJ.COM calculates the  longest line in the
  183. *         block  (40  to 255  char),  then justifies
  184. *         shorter   lines  (up  to  15%  shorter) by
  185. *         imbedding spaces between words.  This block
  186. *         was   right  justified  with  @F6  WITHOUT
  187. *         asterisks.
  188. *
  189. @F6 Macrobegin
  190. *---Copy Block To Temp File-------------*
  191.         Editfile "c:!" Return           * Load temp file c:!
  192.         Killfile Quit                   * Kill/quit it
  193.         Gotoblockbeg                    * Position cursor to come back
  194.         Jfalse STOP:                    * Stop macro if no block
  195.         Onewindow                       * Close all windows
  196.         Horizontalwindow Zoomwindow     * Open window
  197.         Editfile Return                 * Load blank temp file c:!
  198.         Copyblock                       * Copy block to c:!
  199. *---Cut "c:!.rj" To Scrap---------------*
  200.         Unmarkblock Begfile             * Unmark block & go to bof c:!
  201.         Insertline Currentfilename      * Insert CurrentFileName "c:!"
  202.         ".rj"                           * Add ".rj" extension
  203.         Cut                             * Cut "c:!.rj" to scrap
  204. *>>> QCONFIG.DAT must be configured to cut unmarked lines to scrap: <<<
  205. *>>> Should Cut and Copy use current line if no block marked (Y/N)? [Y]
  206.         Savefile                        * Save c:! to right justify it
  207. *---Right Justify Temp File-------------*
  208.         DOS "RJ " Currentfilename       * Right justify c:! temp file
  209.         ">" Paste Return Return         * to c:!.rj
  210.         Editfile Paste Return Quit      * Quit c:!.rj if loaded
  211.         Horizontalwindow Zoomwindow     * Open window
  212.         Editfile Return                 * Load justified file c:!.rj
  213. *---Mark Right Justified Block----------*
  214.         Markcolumn                      * Begin marking at tof
  215.         Endfile                         * Go to eof
  216.         Gotocolumn "80" Return          * Get all text in block
  217.         Cursorup Markcolumn             * Move up off blank line, mark
  218. *---Copy Right Justified Block Back-----*
  219.         Nextwindow                      * Return to orig file
  220.         Copyoverblock                   * Copy right justified block
  221.                                         * back to where we were
  222. *---Clean Up Temp Files, View RJ Block--*
  223.         Nextwindow Killfile Quit        * Kill/quit c:!.rj and return
  224.                                         * to where we started
  225.         Editfile "c:!" Return           * Load c:! to kill/quit
  226.         Killfile Quit                   * and do it!
  227.         Gotoblockbeg                    * Go back to where we started &
  228.                                         * unmark/save file if OK!
  229.  STOP:                                  * We're done.....
  230. *
  231. * 83 bytes Mon  02-25-1991  06:51:47
  232.  
  233. * 
  234. * -------------------------------------------
  235. * #(f7_) Left Justify Column Block, Right Ragged
  236. * -------------------------------------------
  237. *
  238. #f7     MacroBegin                      *
  239.         EditFile "nul" Return Quit      * Quit nul file if loaded
  240.         GotoBlockBeg                    * Position cursor for paste back
  241.         EditFile Return                 * Load empty nul file
  242.         "a" Return                      * Insert "a" in column to align
  243.                                         * text below left justified
  244.         CopyBlock                       * Copy block to justify to nul
  245.  Label0:                                *
  246.         Align                           * Justify line left
  247.         JTrue Label0:                   * and do until no more to do
  248.         Cut                             * Then cut block to scrap
  249.         Quit                            * Quit nul file
  250.         PasteOver                       * And paste it where we were
  251.         UnmarkBlock                     * Unmark left justified block
  252. *
  253. * 28 bytes Mon  03-18-1991  21:51:51
  254.  
  255. * 
  256. * -------------------------------------------
  257. * #(f8_) Right Justify Column Block, Left Ragged
  258. * -------------------------------------------
  259. *
  260. #f8     MacroBegin                      *
  261.         EditFile "nul" Return Quit      * Quit nul file if loaded
  262.         GotoBlockBeg                    * Position cursor for paste back
  263.         EditFile Return                 * Load empty nul file
  264.         CopyBlock                       * Copy block to justify to nul
  265.         GotoBlockEnd                    * Position cursor at block end
  266.         UnmarkBlock                     * Unmark
  267.  Label1:                                *
  268.         MarkColumn EndLine MarkColumn   * Mark blank space at eol
  269.         Cut                             * Cut it to scrap
  270.         BegLine                         * Move to bol
  271.         Paste                           * Paste blank space at bol
  272.         EndLine                         *
  273.         JTrue Label0:                   * Line has text, go mark eol
  274.         GotoBlockEnd                    *ELSE line has no text,
  275.                                         * nothing to justify, and
  276.                                         * goto block end to dot label
  277.  Label0:                                *
  278.         "."                             * Label eol with dot in case
  279.                                         * last line in block is blank
  280.         CursorLeft CursorLeft           * Move left off dot
  281.         UnmarkBlock                     * Unmark
  282.         CursorUp                        * Move up to next line
  283.         JTrue Label1:                   * And right justify until done
  284.         BegLine                         *ELSE all lines right justified
  285.         CursorRight                     * Move off blank space
  286.         MarkColumn EndFile              * Begin marking, goto eof
  287.         CursorLeft CursorLeft           * Move left off dot
  288.         MarkColumn                      * Mark right justified block
  289.         Copy                            * And copy it to scrap
  290.         Quit                            * Quit nul file
  291.         PasteOver                       * And paste it where we were
  292.         UnmarkBlock                     * Unmark left justified block
  293. *
  294. * 50 bytes Mon  03-18-1991  21:52:05
  295.  
  296.